package managers.socialNetworkManagers;

import java.sql.SQLException;
import java.util.ResourceBundle;

import utils.StackTracePrinter;

import managers.DBManager;
import managers.messengerManager.FeedbackManager;

public class UpdatePersonalMessagesService extends PeriodicService {

	private static final int DEFAULT_UPDATE_PERIOD = 900000; //15 minutes;
	
	public UpdatePersonalMessagesService() {
		this(DEFAULT_UPDATE_PERIOD);
	
	}
	
	public UpdatePersonalMessagesService(int period) {
		super("UpdatePersonalMessage", period);
	}

	@Override
	public void run() {
		try {
			SocialDataUpdateMethods.updateUsers(DBManager.getConnection(), manager);
		} catch (SQLException e) {
			SocialNetworkManager.getSharedInstance().getFeedbackManager().updateStatus(ResourceBundle.getBundle("managers.socialNetworkManagers.messages").getString("m.2"), SocialNetworkFeedbackManager.WARNING);
			StackTracePrinter.print(e);
		}
	}


	
	
}
